import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from 'views/Home'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'home',
    component: Home
  },
  {
    path: '/news',
    name: 'news',
    // 路由懒加载 News组件对应.js文件只有在路由匹配时才引入 首页不引入
    component: () => import('views/News')
  },
  {
    path: '/about',
    name: 'about',
    component: () => import('views/About')
  }
]

const router = new VueRouter({
  base: process.env.BASE_URL,
  routes
})

export default router
